home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d18 / nrpas13.arc / QSIMP.PAS < prev    next >
Pascal/Delphi Source File  |  1991-05-01  |  425b  |  21 lines

  1. PROCEDURE qsimp(a,b: real; VAR s: real);
  2. LABEL 99;
  3. CONST
  4.    eps=1.0e-6;
  5.    jmax=20;
  6. VAR
  7.    j: integer;
  8.    st,ost,os: real;
  9. BEGIN
  10.    ost := -1.0e30;
  11.    os := -1.0e30;
  12.    FOR j := 1 TO jmax DO BEGIN
  13.       trapzd(a,b,st,j);
  14.       s := (4.0*st-ost)/3.0;
  15.       IF (abs(s-os) < eps*abs(os)) THEN GOTO 99;
  16.       os := s;
  17.       ost := st
  18.    END;
  19.    writeln ('pause in QSIMP - too many steps'); readln;
  20. 99:   END;
  21.